<?php
/**
 * [smarty_modifier_truncate_d 截取函数]
 * @param  [type] $string [要截取的字符串]
 * @param  [type] $length [截取的长度]
 * @return [type]         [description]
 */
function smarty_modifier_truncate_d($string,$length,$etc='...')
{
	//如果截取的长度大于字符串的长度
	if($length>=mb_strlen($string,'utf-8')){
 		return mb_substr($string, 0,$length,'utf-8');
	}else{
		return mb_substr($string, 0,$length,'utf-8') . $etc;
	}
  
}










